/**
 * 主页
 */
import HomePage from "@/views/home/Home.vue";

import { createWebHistory, createRouter } from "vue-router";
import { Box, Tickets, User, Setting } from "@element-plus/icons-vue";
import {
  CABINET_PAGE,
  USAGERECORD_PAGE,
  PERSONNEL_PAGE,
  SETTINGS_PAGE,
} from "@/common/names";

// 公共路由

export const routes = [
  {
    path: "/",
    redirect: (to) => {
      return CABINET_PAGE;
    },
    component: HomePage,
    children: [
      {
        path: "/cabinet",
        name: CABINET_PAGE,
        meta: {
          label: "柜子管理",
          icon: Box,
        },
        component: () => import("@/views/cabinet/Cabinet.vue"),
      },
      {
        path: "/usageRecord",
        name: USAGERECORD_PAGE,
        meta: {
          label: "所有记录",
          icon: Tickets,
        },
        component: () => import("@/views/use/UsageRecord.vue"),
      },
      {
        path: "/personnel",
        name: PERSONNEL_PAGE,
        meta: {
          label: "人员管理",
          icon: User,
        },
        component: () => import("@/views/personnel/PersonnelManagement.vue"),
      },
      {
        path: "/setting",
        name: SETTINGS_PAGE,
        meta: {
          label: "系统设置",
          icon: Setting,
        },
        component: () => import("@/views/settings/SettingsPage.vue"),
      },
    ],
  },
  {
    path: "/:pathMatch(.*)*",
    redirect: (to) => {
      return {
        path: "/",
      };
    },
  },
];
